package org.sixtythousand.joker.servlet.session;

import javax.servlet.http.HttpSession;
import java.util.concurrent.ConcurrentMap;

/**
 * @author zhoulk
 * @date 2023/10/13 17:41
 * @desc
 */
public class MemorySessionCache extends AbstractSessionCache{

    private final ConcurrentMap<String, Session> sessions;


    public MemorySessionCache(ConcurrentMap<String, Session> sessions) {
        this.sessions = sessions;
    }

    @Override
    public void cacheSession(String id, Session session) {
        sessions.put(id, session);
    }

    @Override
    public HttpSession getSession(String id) {
        return sessions.get(id);
    }


}
